package com.example.springcloud.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName ApplicationConfig
 * @Author Admin
 * @Date 2020/9/11 15:06
 * @Version 1.0
 **/
@Configuration
public class ApplicationConfig {
    @Bean
    @LoadBalanced  // 使用RestTemplate做负载均衡，需要添加@LoadBalanced注解
    public RestTemplate getRestTemplate() {
        return new RestTemplate();
    }
}
